﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A87随机打乱数组元素
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] puker = { "J", "Q", "K", "A" };
            DisSort(puker);

            foreach (var item in puker)
            {
                Console.WriteLine(item);
            }
        }
        static void DisSort(string[] array ) 
        {
            Random ran = new Random();
            for (int i = 0; i < array.Length; i++)
            {
                //拿到一个随机的位置
                int index = ran.Next(0,array.Length);
                //把当前位置的元素和随机位置的元素交换一下
                string temp = array[i];
                array[i] = array[index];
                array[index] = temp;
            }
        }
        
    }
}
